<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			/*
			  switch(表达式){
			    case 值1:
			      语句;
			      break;
			    case 值2:
			      语句;
			      break;
			    case 值3:
			      语句;
			      break;
			    ...
			    default:
			      语句;
			  }
			  
			  if和switch的区别:
			  1.范围判断用if
			  2.确定值判断用switch
			  3.选项比较少时用switch
	    */
			var name = "lisi";
			switch (name) {
				case "zhangsan":
					console.log("zhangsan");
					// break;//退出（结束）
				case "lisi":
					console.log("lisi");
					// break;
				case "wangwu":
					console.log("wangwu");
					// break;
				default:
					console.log("666");
			}

			if (name == "zhangsan") {
				console.log("zhangsan");
			}
			if (name == "lisi") {
				console.log("lisi");
			}
			if (name == "wangwu") {
				console.log("wangwu");
			}

			if (name == "zhangsan") {
				console.log("zhangsan");
			} else if (name == "lisi") {
				console.log("lisi");
			} else if (name == "wangwu") {
				console.log("wangwu");
			} else {
				console.log("666");
			}


			/*
			  case中最好加break,如果没有break,那么匹配成功后,其它的case就不再匹配，直接执行case中的代码
			
			*/

			/*
			 根据用户的输入数，
			 1.输出对应的月份 1一月 2二月 3三月 4四月...12十二月
			 2.输出对应的天数  31    29   31    30
			 
			*/
			var month = prompt("请输入月份对应的数");
			// console.log(typeof month);
			month = month - 0; //隐式转换
			// console.log(typeof month);
			switch (month) {
				case 1:
					console.log("一月");
					break;
				case 2:
					console.log("二月");
					break;
				case 3:
					console.log("三月");
					break;
				case 4:
					console.log("四月");
					break;
				case 5:
					console.log("五月");
					break;
				case 6:
					console.log("六月");
					break;
				case 7:
					console.log("七月");
					break;
				case 8:
					console.log("八月");
					break;
				case 9:
					console.log("九月");
					break;
				case 10:
					console.log("十月");
					break;
				case 11:
					console.log("十一月");
					break;
				case 12:
					console.log("十二月");
					break;
			}
		</script>
	</head>
	<body>
	</body>
</html>
